import { thin } from "../thin3.mjs";

export default function collectdata(container) {
  let data = {};
  if (container)
    thin("input,textarea,select", container).each((e) => {
      if (e.name) {
        // console.log({ element: e, value: e.value });
        if (e.type === "checkbox") {
          data[e.name] = e.checked;
        } else {
          data[e.name] = e.value?.trim();
        }
      }
    });
  return data;
}
